import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import ElementUI from 'element-ui'
import locale from 'element-ui/lib/locale/lang/zh-CN'
import 'element-ui/lib/theme-chalk/index.css'
import './element'
import '@/css/index.scss'
import 'vxe-table/lib/index.css'
import VXETable from 'vxe-table'
// import 'lib-flexible'
import './utils/flexible.js'

// 引入自定义指令
import '@/directive/el-select-loadmore/index'
import '@/directive/persstion-btn/index'
import '@/directive/clickoutside/index'
import '@/directive/el-table/index.js'
import AMap from 'vue-amap'

Vue.config.productionTip = false
Vue.use(ElementUI, { locale, size: 'small' })
Vue.use(AMap)
Vue.use(VXETable) // 树形表格控件

Vue.prototype.$message = (msg) => {
        ElementUI.Message({...msg, duration: 500 })
    }
    [
        { name: 'success', time: '500' },
        { name: 'warning', time: '1000' },
        { name: 'error', time: '1500' },
        { name: 'info', time: '1500' }
    ].forEach(item => {
        Vue.prototype.$message[item.name] = function(msg) {
            return ElementUI.Message[item.name]({
                message: msg,
                duration: item.time
            })
        }
    })

new Vue({
    router,
    store,
    render: h => h(App)
}).$mount('#app')